package org.seedltd.upms.model.sys.vo;

import lombok.Getter;
import lombok.Setter;
import org.seedltd.upms.constant.GlobalConst;

import java.util.Set;

/**
 *
 * 菜单元数据
 *
 * @author laizuan
 * @since 2020年03月13日 10:42
 */
@Getter
@Setter
public class MenuMetaVO {
    /**
     * 国际化 Key
     */
    private String i18n;

    /**
     * 页面按钮权限
     */
    private Set<String> permissions;

    /**
     * 菜单显示名称
     */
    private String title;

    /**
     * 激活菜单名称
     */
    private String activeMenu;

    /**
     * 路由的图标
     */
    private String icon;

    /**
     * 如果设置为true，则不会被 <keep-alive> 缓存(默认 true)
     */
    private boolean noCache = true;

    /**
     * 若果设置为true，它则会固定在tags-view中(默认 false)
     */
    private boolean affix = false;

    public MenuMetaVO(String title, String icon, boolean noCache, boolean affix, String i18n, Set<String> permissions,
        String activeMenu) {
        this.title = title;
        this.icon = icon;
        this.permissions = permissions;
        this.noCache = noCache;
        this.affix = affix;
        this.i18n = i18n;
        this.activeMenu = activeMenu;
    }

    public MenuMetaVO(String title, String icon, Integer noCache, String i18n, Set<String> permissions,
        String activeMenu) {
        this(title, icon, GlobalConst.YES.equals(noCache), false, i18n, permissions, activeMenu);
    }
    public MenuMetaVO(String title, String icon) {
        this(title, icon, true, false, null, null, null);
    }
}
